<template>

  <head>
    <div class="l-head">
      <el-button plain icon="el-icon-menu" size="mini" @click="onisCollapse"></el-button>
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item style="color:aliceblue;"  v-for="item in tags" :key="item.path" :to="{ path: item.path }">{{ item.label }}
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="r-head">
      <el-dropdown trigger="click">
        <span>
          <img class="userimg" :src="user" alt="">
        </span>

        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>个人中心</el-dropdown-item>
          <el-dropdown-item @click.native="loginout">退出</el-dropdown-item>

        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </head>
</template>

<script>

import { mapState } from 'vuex';
export default {
  name: 'MagementHeader',

  data() {
    return {
      user: require('@/assets/head.png')
    };
  },

  mounted() {

  },

  methods: {
    onisCollapse() {
      this.$store.commit('collapsemenu');
      
      
    },
    loginout(){
      this.$store.commit('clearToken');
      this.$store.commit('clearMenmu');
    this.$router.push('/login')

    }
    


  },
  computed: {
    ...mapState({
      tags: state => state.tab.tabList
    }),
  },
  updated() {
    console.log(this.tags);
  },
   
};
</script>

<style lang="less" scoped>
head {
  width: 100%;
  display: flex;
  height: 100%;
  justify-content: space-between;
  align-items: center;
  

  .l-head {
    display: flex;
    height: 50%;
    align-items: center;

    .el-button {
      margin-left: 20px;
    }

    h4 {
      margin-left: 20px;
    }
 
  }

  .r-head {
    margin-right: 30px;
    display: flex;
    height: 50%;
    align-items: center;

    .userimg {
      width: 40px;

      border-radius: 50%
    }
  }

}
</style>